<?php
session_start();
include("../corePage/common.php");
$userId = $_SESSION['sysUserId'];
$level = $_SESSION['sysUserLevel'];
if(isset($userId) && isset($level)){
?>
<!DOCTYPE html>
<html lang="zh-CN">
	<head>
		<meta charset="utf-8">
		<title><?php echo $webSiteName;?></title>
		<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="author" content="<?php echo $author;?>">
		<link rel="shortcut icon" href="<?php echo $webSiteIco;?>" >
		<!-- CSS -->
		<link href="<?php echo $bootstrapCssUrl;?>" rel="stylesheet">
		<link href="<?php echo $bootstrapThemeCssUrl;?>" rel="stylesheet">
		<link href="<?php echo $commonCss;?>" rel="stylesheet">
		<link href="<?php echo $cssUrl.'/userList.css';?>" rel="stylesheet">
		<!-- JS -->
		<script src="<?php echo $jquery1MinUrl;?>"></script>
		<script src="<?php echo $bootstrapJsUrl;?>"></script>
		<script src="<?php echo $commonJs;?>"></script>
		<script src="<?php echo $jsUrl.'/userList.js';?>"></script>
		<style>
			table th,td{text-align: center;}
		</style>
	</head>
	<body>
		<div class="page-header">
		  <h1>&nbsp;&nbsp;用户管理 <small>user management</small></h1>
		</div>
		<table class="table table-bordered">
			<thead>
				<tr><th>用户名</th><th>真实姓名</th><th>用户角色</th><th>电子邮件</th></tr>
			</thead>
			<tbody>
				<?php
					#查询用户信息
					$sql="select ".$username_field.",nickname,level,email from ".$database_prefix."_user where level < $level";
					$userObjectList = select_ObjectList($sql);
					if($userObjectList){
						for($i=0;$i<count($userObjectList);$i++){
							$userObject = $userObjectList[$i];
							$username = $userObject["username"];
							$nickname = $userObject["nickname"];
							$level = $userObject["level"];
							$email = $userObject["email"];
							echo "<tr><td>".$username."</td><td>".$nickname."</td><td>".$level."</td><td>".$email."</td></tr>";
						}
				    }
				?>
			</tbody>
		</table>
	</body>
</html>		

<?php
}else{
?>
<script>window.location.href="<?php echo $domainName.'/'.$projectName.'/viewPage/login.php' ?>";</script>
<?php
}
?>
